# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=libetebase
pkgver=0.5.4
pkgrel=1
pkgdesc='Etebase C library'
arch=(x86_64)
url='https://github.com/etesync/libetebase'
license=(BSD)
depends=(openssl gcc-libs libsodium)
makedepends=(rust)
source=(https://github.com/etesync/libetebase/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('ba0d6740d39d7d09cdf2dda4e73716a3c05502770a40b8087582570bd1c31752')

prepare() {
  cd $pkgname-$pkgver
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd $pkgname-$pkgver
  env CARGO_INCREMENTAL=0 SODIUM_USE_PKG_CONFIG= cargo build --release --locked --offline
  make pkgconfig
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
